<div class="buildings index">
	<h2><?php __('Buildings');?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('building_name');?></th>
			<th><?php echo $this->Paginator->sort('apt_business');?></th>
			<th><?php echo $this->Paginator->sort('regular_fund');?></th>
			<th><?php echo $this->Paginator->sort('special_fund');?></th>
			<th><?php echo $this->Paginator->sort('expense_liquidation_type');?></th>
			<th><?php echo $this->Paginator->sort('doorman_id');?></th>
                        <th><?php echo $this->Paginator->sort('customer_id');?></th>
			<th><?php echo $this->Paginator->sort('address_id');?></th>
			<th><?php echo $this->Paginator->sort('end_date');?></th>
			<th><?php echo $this->Paginator->sort('created');?></th>
			<th><?php echo $this->Paginator->sort('updated');?></th>
			<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($buildings as $building):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $building['Building']['building_name']; ?>&nbsp;</td>
		<td><?php echo $building['Building']['apt_business']; ?>&nbsp;</td>
		<td><?php echo $building['Building']['regular_fund']; ?>&nbsp;</td>
		<td><?php echo $building['Building']['special_fund']; ?>&nbsp;</td>
		<td>
			<?php echo $building['BuildingExpenseLiquidationType']['meaning']?>
		<td>
			<?php echo $this->Html->link($building['BuildingDoorman']['surname'], array('controller' => 'people', 'action' => 'view', $building['BuildingDoorman']['person_id'])); ?>
		</td>
                <td>
			<?php echo $this->Html->link($building['Customer']['customer_name'], array('controller' => 'customers', 'action' => 'view', $building['Customer']['customer_id'])); ?>
		</td>
		<td>
			<?php echo $this->Html->link($building['Address']['address_id'], array('controller' => 'addresses', 'action' => 'view', $building['Address']['address_id'])); ?>
		</td>
		<td><?php echo $building['Building']['end_date']; ?>&nbsp;</td>
		<td><?php echo $building['Building']['created']; ?>&nbsp;</td>
		<td><?php echo $building['Building']['updated']; ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('View', true), array('action' => 'view', $building['Building']['building_id'])); ?>
                        <?php if (!$building['Building']['end_date']) { ?>
                            <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $building['Building']['building_id'])); ?>
                            <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $building['Building']['building_id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $building['Building']['building_id'])); ?>
                        <?php } ?>
                        <?php echo $this->Html->link(__('Process Month', true), array('action' => 'process_month_expenses', $building['Building']['building_id'])); ?>
			<?php echo $this->Html->link(__('Print Expenditures Resume', true), array('action' => 'print_expenditures_resume', $building['Building']['building_id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('New Building', true), array('action' => 'add')); ?></li>
		<li><?php echo $this->Html->link(__('List People', true), array('controller' => 'people', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Lookup Values', true), array('controller' => 'lookup_values', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Addresses', true), array('controller' => 'addresses', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Payment Dues', true), array('controller' => 'payment_dues', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Refinancing Systems', true), array('controller' => 'refinancing_systems', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Expenditures', true), array('controller' => 'expenditures', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Periodic Expenditure Types', true), array('controller' => 'periodic_expenditure_types', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Properties', true), array('controller' => 'properties', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('List Property Types', true), array('controller' => 'property_types', 'action' => 'index')); ?> </li>
	</ul>
</div>
